<?php
/**
 * auth WQl
 * 2021/6/16 18:10
 */
namespace m;

class UserM extends BasicM
{
    use \Singleton;

    //workermanorm使用
    private $table_name = "sm_admin_user";

    //thinkorm 配置
    protected $name = "admin_user";

    /**
     * 用户登录
     * @throws \ApiError
     */
    public function login($where)
    {
        $info = \Db::getInstance()->select('id,info,real_name,role,phone,last_ip,last_time')
            ->from($this->table_name)
            ->where($this->encodeWhere($where))
            ->row();
        if(!$info) throw new \ApiError("账号或密码错误");
        return $info;
    }
}